package com.mxpio.erp.common.equipment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.DictAble;
import com.mxpioframework.jpa.annotation.Generator;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = "V_MB_ERP_EQUIPMENT_EQP")
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "设备视图")
public class VEquipmentEqp implements DictAble, Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "ID_", updatable = false)
    @Generator
    @Schema(description = "id")
    private String id;

    @Column(name = "EQP_NAME_")
    @Schema(description = "设备名称")
    private String eqpName;

    @Column(name = "EQP_CODE_")
    @Schema(description = "设备编码")
    private String eqpCode;

    @Column(name = "AREA_NAME_")
    @Schema(description = "区域名称")
    private String areaName;

    @Column(name = "CODE_")
    @Schema(description = "资产编号")
    private String code;

    @Column(name = "EQP_TYPE_NAME_")
    @Schema(description = "设备分类")
    private String eqpTypeName;

    @Column(name = "SEQ_NUMBER_")
    @Schema(description = "设备序列号")
    private String seqNumber;

    @Column(name = "CREATE_TIME", updatable = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "创建时间")
    private Date createTime;
    @Transient
    private Map<String, String> textMap;

    public String putText(String key, String value) {
        if (textMap == null) {
            textMap = new HashMap<>();
        }
        return textMap.put(key, value);
    }
}
